#!/bin/bash
ecocycData="./ecoli/ecocyc/"
working_directory="./example/"

libs_dir="./libs"
java_cp="$libs_dir/jgrapht-jdk1.6.jar:$libs_dir/colt-1.2.0.jar"

geneDistance="10"
input="${working_directory}/reactions_list.txt"
output="${working_directory}/queries_$geneDistance_genes.txt"
geneFile="${ecocycData}/genes.dat"
proteinFile="${ecocycData}/proteins.dat"


#java_cp="$libs_dir/jgrapht-jdk1.6.jar:$libs_dir/colt-1.2.0.jar:$libs_dir/collections-generic-4.01.jar"
#-------------------------------------------#
#        "Reaction list generation"         #
#-------------------------------------------#

#permut columns
awk '{print $2 "\t" $1}' "${working_directory}/catalyze.txt" > "${working_directory}/catalyze_inv.txt"

#generate reaction list
awk '{print $1}' "${working_directory}/associationsR.txt" > "$input"

echo "Reaction list generation"
#Creating a list of kSIPs queries as a list of couple of start -> end reaction with some filtering options.
#java -classpath sipper.jar:"$java_cp" combi.wip.sipper.exec.GenerateKSIPsEndPoints l|i fileIn fileOut none|geneDistance=XX|reactionDistance=XX
# - The first parameter is "l" or "i" and defines the form of the entry file. The parameter "l" means the entry file is a set of reaction and all possible couples from this set will be generate. The parameter "i" indicate that the list is already under the form r1 -> r2 and no more couples will be generate.
# - none means no filtering, geneDistance=XX keep only reactions that are distant at most XX genes (i.e. in an interval of x+1 genes), end reactionDistance=XX  keep only reaction that are distant at most XX arcs in the graph reaction.
java -classpath sipper.jar:"$java_cp" combi.wip.sipper.exec.GenerateKSIPsEndPoints l "$input" "$output" "geneDistance=$geneDistance" "$geneFile" "${working_directory}/catalyze_inv.txt" "$proteinFile"
